﻿#pragma once
#include<string>
#include"index_struct.h"
#include<set>
#include"Struct.h"
#include<vector>
#include<list>
using namespace std;

#define CacheSize 5
//索引管理，管理与索引相关的所有过程。



class index_manage
{
public:

	index_manage();
	~index_manage();

	void insert(string path, string auth, indexInt index);
	void insert(string path, string auth, indexDouble index);
	void insert(string path, string auth, indexChar index);

	vector<int> update(string path, string auth, struct_where index);
	
	void index_manage::ReProduceIndex(string path, string column, string auth, int pos, int lenth, int size);

	vector<int> select(string path, string auth, struct_where index);

	bool IsInMem(string auth);

private:

	set<string>indexNames;
	list<MIndexInt>containerInt;
	list<MIndexDouble>containerDouble;
	list<MIndexChar>containerChar;

	
	void Erase(string auth);
	void push_to_mem(string path, struct_where index, string auth);
	void findResult(vector<int>&, struct_where index, string);
	void findInt(vector<int>&, struct_where index, string);
	void findDouble(vector<int>&, struct_where index, string);
	void findChar(vector<int>&, struct_where index, string);
};

